package com.example.zsydb.service;


import com.example.zsydb.repository.ResultRepository;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class ResultService {

    private final ResultRepository resultRepository;

    public ResultService(ResultRepository resultRepository) {
        this.resultRepository = resultRepository;
    }

    public Map<String, Object> getResults(int page, int size) {
        List<Map<String, Object>> data = resultRepository.findResults(page, size);

        // 构建符合要求的JSON结构
        Map<String, Object> response = new HashMap<>();
        response.put("data", data);
        return response;
    }
}